<template>
  <basic-container>
    <avue-tree :permission="getPermission" :loading="loading" :option="leftTreeOption" :data="treeData" @node-click="nodeClick">
      <span class="el-tree-node__label" slot-scope="{ node, data }">
        <span>
          <i class="el-icon-files"></i>
          {{ (node || {}).label }}
        </span>
      </span>
    </avue-tree>
  </basic-container>
</template>
<script>
  export default {
    data(){
      return{
        loading:false,
        leftTreeOption:{
          title:'我是标题',
          filterText:"搜索关键字自定义",
          defaultExpandAll:true,
          menu:false,
          addBtn:false
        },
      }
    },
    props:{
      treeData:[Array,Object],
      type:String
    },
    methods:{
      getPermission(key, data) {
        if (key == "addBtn"&&data.value==0) { return false; }
        return true;
      },
      nodeClick(data){
        console.log(data)
      },
    }
  }
</script>
<style lang="scss" scoped>
.basic-container{
  padding: 10px 15px;
  height: 100%;
  .avue-tree{
    height: 100%;
    .avue-tree__content{
      overflow: auto;
    }
  }
}
</style>
